package com.snow.campuslink.user.controller;


import com.snow.campuslink.project.result.Result;
import com.snow.campuslink.user.entity.UserMessage;
import com.snow.campuslink.user.service.IUserMessageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Gaosl
 * @since 2021-03-02
 */
@RestController
@RequestMapping("/user/user-message")
public class UserMessageController {

    
    @Resource
    IUserMessageService userMessageService;

    @ApiOperation(value = "")
    @PostMapping("saveMessage")
    public Result saveMessage(@RequestBody UserMessage userMessage){
        userMessageService.save(userMessage);
        return Result.success();
    }

    @ApiOperation(value = "")
    @GetMapping("getFriendship")
    public Result getFriendship(@RequestBody  UserMessage userMessage){
        List<UserMessage> list= userMessageService.getFocus(userMessage);
        return Result.success().data(list);
    }

    @ApiOperation("")
    @DeleteMapping("deleteFocus/{messageId}")
    public Result removeById (@PathVariable("messageId") Long messageId){
        userMessageService.removeById(messageId);
        return Result.success();
    }


}

